This is commonly done with the LIST_HEAD macro, which provides the declaration and initialization of the list.
这通常通过list_head宏来完成,这个宏提供列表的声明和初始化。
This macro permits iteration over the list with safeguards against removal of a list entry (which you'll do as part of the iteration).
这个宏将迭代列表,但阻止删除列表条目(删除列表条目是迭代操作的一部分)。
You can also create a list head manually (for example, if your list head is in another structure) through the use of the LIST_HEAD_INIT macro.
也可以通过使用LIST_HEAD_INIT宏手动创建一个列表头(例如,您的列表头位于另一个结构中)。
应用推荐